package org.dizena.blog.starter.config.demo0;
 
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 
@Configuration
public class HeaderHandlerConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 这个自动将header数据放入ThreadLocal中
        registry.addInterceptor(new HeaderHandlerInterceptor()).addPathPatterns("/**");
    }
}